//
//  ShowPhotoCell.m
//  ImGuider
//
//  Created by 李陆涛 on 2017/10/13.
//  Copyright © 2017年 AudioCtrip. All rights reserved.
//

#import "ShowPhotoCell.h"
#import <Photos/Photos.h>
#import "TZImagePickerController.h"
#import "UIView+Layout.h"
@implementation ShowPhotoCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        _imageView = [[UIImageView alloc] init];
        _imageView.contentMode = UIViewContentModeScaleAspectFill;
        _imageView.layer.borderColor = kBGColor.CGColor;
        _imageView.layer.borderWidth = 1.0f;
        
        [self addSubview:_imageView];
        
        [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
        
        
        self.clipsToBounds = YES;
        
        _deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        
        [_deleteBtn setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal];

        [self addSubview:_deleteBtn];
        
        _deleteBtn.backgroundColor = [kContentColor colorWithAlphaComponent:0.5];
        
        [_deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self);
            make.right.equalTo(self);
            make.width.mas_equalTo(30);
            make.height.mas_equalTo(30);
        }];
        _deleteBtn.imageView.contentMode = UIViewContentModeScaleAspectFill;
        _deleteBtn.imageView.clipsToBounds = YES;
        [_deleteBtn.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.width.mas_equalTo(16);
            make.height.mas_equalTo(16);
        }];
    }
    return self;
}


- (void)setRow:(NSInteger)row {
    _row = row;
    _deleteBtn.tag = row;
}

@end
